const app = getApp()
//const user = JSON.parse(wx.getStorageSync("user"));
const base_url = app.globalData.base_url;
const util = require('../../utils/util.js');

Page({
  data: {
    year:'',
    month:'',
    day:'',
    date:'',
  },
  onLoad:  function() {
    wx.setNavigationBarTitle({
      title: '发布'
    })
    let time = new Date();
    let day = '星期';
    switch (time.getDay()){
      case 1: day = day + '一';break
      case 2: day = day + '二';break
      case 3: day = day + '三';break
      case 4: day = day + '四';break
      case 5: day = day + '五';break
      case 6: day = day + '六';break
      case 7: day = day + '日';break
    }
    this.setData({
      year: time.getFullYear(),
      month: (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1): time.getMonth() +1,
      date: time.getDate(),
      day: day,
    })
    
  },
  onReady: function () {
    // 页面渲染完成
 
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  },
  close(){
    wx.navigateBack({//返回
      delta: 1
    })
  },
  publish:function(e){
    let type = e.currentTarget.dataset.type;
    if(type == 0){
      wx.redirectTo({
        url: '../post/post'
      })
    }else{
      wx.redirectTo({
        url: '../saleform/saleform'
      })
    }
  }
})
